// @ts-ignore
import {callApi} from "../../callApi.ts";
export async function loginRequitApi(username: string, password: string)
{
    const data={
        username:username,
        password:password
    }
    // const headers={
    //     "Content-Type": "application/json"
    // }
    // try{
    //     const response = await axios.post("http://localhost:8000/login/",
    //         data,
    //         {
    //             headers:headers
    //         }
    //     )
    //     console.log(response.data)
    //     return response.data;
    // }catch(error){
    //     console.log(error)
    //     throw error;
    // }
    const response:any=await callApi('/login/','POST',data)
    localStorage.setItem('access_token', response.data.access_token);
    localStorage.setItem('refresh_token', response.data.refresh_token);
}